<?php
namespace Plugin\Alarm\Schema;

use Plugin\Alarm\Model\RdAlarmWorkApply;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 工单转移申请
 */
#[Schema(title: 'RdAlarmWorkApplySchema')]
class RdAlarmWorkApplySchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'id', type: 'bigint')]
    public string $id;

    #[Property(property: 'work_id', title: '工单ID', type: 'bigint')]
    public string $work_id;

    #[Property(property: 'user_id', title: '接收用户ID', type: 'bigint')]
    public string $user_id;

    #[Property(property: 'status', title: '状态 0待处理 1同意 2拒绝', type: 'tinyint')]
    public string $status;

    #[Property(property: 'remark', title: '备注', type: 'string')]
    public string $remark;

    #[Property(property: 'handle_remark', title: '处理备注', type: 'string')]
    public string $handle_remark;

    #[Property(property: 'created_by', title: '创建人', type: 'bigint')]
    public string $created_by;

    #[Property(property: 'updated_by', title: '更新人', type: 'bigint')]
    public string $updated_by;

    #[Property(property: 'created_at', title: '创建时间', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: '更新时间', type: 'timestamp')]
    public string $updated_at;

    public function __construct(RdAlarmWorkApply $model)
    {
       $this->id = $model->id;
       $this->work_id = $model->work_id;
       $this->user_id = $model->user_id;
       $this->status = $model->status;
       $this->remark = $model->remark;
       $this->handle_remark = $model->handle_remark;
       $this->created_by = $model->created_by;
       $this->updated_by = $model->updated_by;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;
    }

    public function jsonSerialize(): array
    {
        return [
            'id' => $this->id,
            'work_id' => $this->work_id,
            'user_id' => $this->user_id,
            'status' => $this->status,
            'remark' => $this->remark,
            'handle_remark' => $this->handle_remark,
            'created_by' => $this->created_by,
            'updated_by' => $this->updated_by,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at
        ];
    }
}